import {GET, POST} from "@/api/network";

export module Api {


    export interface LoginRequest {
        account : string;
        password: string;
    }

    interface LoginResponse {
        uid:string
        token:string
    }

    export function Login(ask: LoginRequest) : Promise<LoginResponse> {
        return POST<LoginResponse>(
            '/login',
            ask,
        )
    }

    export module User {
        export interface GetUserProfileRequest {
            uid:string
        }

        export interface GetUserProfileResponse {
            name:string
            avatar:string
            star_id:string
            star_name:string
            star_avatar:string
            is_club_manager:boolean
            club_id:string
            followed:string
        }

        export function GetUserProfile(ask:GetUserProfileRequest): Promise<GetUserProfileResponse> {
            return GET(
                `/user/profile/${ask.uid}`
            )
        }


        /*
        Name           string `json:"name"`
		Avatar         string `json:"avatar"`
		StarId         string `json:"star_id"`
		StarName       string `json:"star_name"`
		StarAvatar     string `json:"star_avatar"`
		IsClubManager  bool   `json:"is_club_manager"`
		ClubID         string `json:"club_id"`
		ClubName       string `json:"club_name"`
		ClubStarName   string `json:"clbu_star_name"`
		ClubStarAvatar string `json:"club_star_avatar"`
		Followed       bool   `json:"followed"`
         */

        export interface GetUserInfoRequest {
            uid:string
        }

        export interface GetUserInfoResponse {
            name:string
            avatar:string
            star_id:string
            star_name:string
            star_avatar:string
            is_club_manager:boolean
            club_id:string
            club_name:string
            followed:boolean
        }

        export function GetUserInfo(ask:GetUserInfoRequest): Promise<GetUserInfoResponse> {
           return GET(
                `/user/info/${ask.uid}`
            )
        }
    }



}

export default Api.User